package com.example.qmjy.activity;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

import com.example.qmjy.R;

public class LoginActivity extends AppCompatActivity implements View.OnClickListener {
    // 定义一个标签变量
    private static final String TAG = "LoginActivity";

    // 定义一个按钮变量
    private Button login_tv;

    @SuppressLint("MissingInflatedId")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.activity_login);

        // 给login_tv变量赋值，通过id关联布局文件中的空间
        login_tv = findViewById(R.id.login_tv);

        // 给login_tv按钮绑定监听事件
        login_tv.setOnClickListener(this);

        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.login_11), (v, insets) -> {
            Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
            return insets;
        });
    }


    @Override
    public void onClick(View v){
        // 弹出Toast消息提示
        Toast.makeText(this,"点击了登录按钮",Toast.LENGTH_SHORT).show();

        // 输出debug级别Log
        Log.d(TAG,"onClick");
    }
}